﻿using GrainManage.Entities.Price;
using GrainManage.Server.Business;
using System.Web.Mvc;

namespace GrainManage.Server.Controllers
{
    public class PriceController : BaseController
    {
        private readonly PriceBusiness business = new PriceBusiness();

        //************************************************POST************************************************
        [HttpPost]
        public ActionResult GetByID(InputGetByID input)
        {
            var result = business.GetByID(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetRecentPriceByGrain(InputGetRecentPriceByGrain input)
        {
            var result = business.GetRecentPriceByGrain(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult SearchRecentPrice(InputSearchRecentPrice input)
        {
            var result = business.SearchRecentPrice(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult SearchPrice(InputSearchPrice input)
        {
            var result = business.SearchPrice(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult Insert(InputInsert input)
        {
            var result = business.Insert(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult Update(InputUpdate input)
        {
            var result = business.Update(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult Delete(InputDelete input)
        {
            var result = business.Delete(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult BatchInsert(InputBatchInsert input)
        {
            var result = business.BatchInsert(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult BatchUpdate(InputBatchUpdate input)
        {
            var result = business.BatchUpdate(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult BatchDelete(InputBatchDelete input)
        {
            var result = business.BatchDelete(input);
            return NewtonsoftJson(result);
        }
    }
}
